<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>mojo event - removeEvent</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<script type="text/javascript" src="../../js/head.js"></script>
	</head>
	
<body>

<pre id="id1">
<div class="target" id="id1-target1">#id1-target1</div>	
<button onclick="exeScript('id1-source1')">addEvent</button>
<code id="id1-source1">
mojo("#id1-target1").addEvent("click", foo);
</code>
<button onclick="exeScript('id1-source2')">removeEvent</button>
<code id="id1-source2">
mojo("#id1-target1").removeEvent("click", foo);
</code>
</pre>



<pre id="id2">
<div class="target" id="id2-target1">#id2-target1</div>	
<button onclick="exeScript('id2-source1')">addEvent</button>
<code id="id2-source1">
mojo("#id2-target1").addEvent('click', function(){
	log.info('点击一!').alert();
})
.addEvent('click', function(){
	log.info('点击二!').alert();
})
</code>
<button onclick="exeScript('id2-source2')">removeEvent</button>
<code id="id2-source2">
mojo("#id2-target1").removeEvent("click");
</code>
</pre>	


<pre id="id3">
<div class="target" id="id3-target1">#id3-target1</div>	
<button onclick="exeScript('id3-source1')">addEvent</button>
<code id="id3-source1">
function test() {
	log.info('事件: {}', this.event.type)
	   .render(this.el);
};
	
mojo("#id3-target1").addEvent({
	'click': test,
	'mouseover': test,
	'mouseout': test
});
</code>
<button onclick="exeScript('id3-source2')">removeEvent</button>
<code id="id3-source2">
mojo("#id3-target1").removeEvent();
</code>
</pre>

</body>

<script type="text/javascript">
var body = document.body;

API.add({
	title: [
		"removeEvent", 
		"String eventType, Function fn", 
		"mojo"
	],
	summary: [
		"移除对应事件类型的对应事件函数"
	],
	params: [{
		name: "eventType: String",
		desc: "事件类型"
	}, {
		name: "fn: Function",
		desc: "需要移除的事件函数"
	}],
	rt: [{
		name: "mojo"
	}],
	examples: [{
		desc: "移除点击事件",
		codeId: "id1"
	}]
})

//
.add({
	title: [
		"removeEvent", 
		"String eventType", 
		"mojo"
	],
	summary: [
		"移除事件类型的所有函数"
	],
	params: [{
		name: "eventType: String",
		desc: "事件类型"
	}],
	rt: [{
		name: "mojo"
	}],
	examples: [{
		desc: "移除所有点击事件",
		codeId: "id2"
	}]
})

.add({
	title: [
		"removeEvent", 
		"", 
		"mojo"
	],
	summary: [
		"移除所有事件函数"
	],
	params: [],
	rt: [{
		name: "mojo"
	}],
	examples: [{
		desc: "移除所击事件",
		codeId: "id3"
	}]
})


//
.render(body);



window.foo = function() {
	log.info("事件: {}", this.event.type)
	   .alert();
}

</script>

</html>